When allocated memory for a software object is no longer in use (e.g., designated as garbage), garbage collection (GC) methods are typically employed to reduce memory fragmentation (e.g., gaps in active memory) and to enable the corresponding memory resources to be reallocated during the session in which the software program is running. Although GC operations are essential for memory management in systems with implicit memory management (e.g., Java, .NET), the computational cost is significant (e.g., linear in the number of active memory elements in the memory heap for each garbage collection). Furthermore, these collections typically require a stop-the-world phase where other operations are suspended while the GC operations are being carried out.
Because a substantial portion of allocated memory often becomes garbage relatively soon after the initial allocation, garbage collections are often carried out more frequently for younger objects as compared with older objects that have survived multiple garbage collections. However, memory is typically allocated similarly for all objects even when information is available to suggest that an object is expected to have a relatively long lifespan. As a result, frequent garbage collections are carried out even for objects that are expected to survive for relatively long times. Thus, there is a need for memory allocation methods that incorporate information related to the expected lifespan of objects for which memory is being allocated.